package bp.sys;

import bp.en.EntityMyPK;
import bp.en.Map;
import bp.en.UAC;
import bp.web.WebUser;

/// <summary>
/// 数据源存储
/// </summary>
public class GenerDBSrc extends EntityMyPK
{
	///#region 基本属性
	public final String getRefPKVal()
	{
		return this.GetValStrByKey(GenerDBSrcAttr.RefPKVal);
	}
	public final void setRefPKVal(String value)
	{
		this.SetValByKey(GenerDBSrcAttr.RefPKVal, value);
	}
	/**
	 大屏的编号
	 */
	public final String getRptWindowsNo()
	{
		return this.GetValStrByKey(GenerDBSrcAttr.OperID1);
	}
	public final void setRptWindowsNo(String value)
	{
		this.SetValByKey(GenerDBSrcAttr.OperID1, value);
	}
	public final String getOperID2()
	{
		return this.GetValStrByKey(GenerDBSrcAttr.OperID2);
	}
	public final void setOperID2(String value)
	{
		this.SetValByKey(GenerDBSrcAttr.OperID2, value);
	}
	public final String getOperID1()
	{
		return this.GetValStrByKey(GenerDBSrcAttr.OperID1);
	}
	public final void setOperID1(String value)
	{
		this.SetValByKey(GenerDBSrcAttr.OperID1, value);
	}
	public final String getMarkID()
	{
		return this.GetValStrByKey(GenerDBSrcAttr.MarkID);
	}
	public final void setMarkID(String value)
	{
		this.SetValByKey(GenerDBSrcAttr.MarkID, value);
	}
	/**
	 组织编号
	 */
	public final String getOrgNo()
	{
		return this.GetValStrByKey(GenerDBSrcAttr.OrgNo);
	}
	public final void setOrgNo(String value)
	{
		this.SetValByKey(GenerDBSrcAttr.OrgNo, value);
	}
	/**
	 记录人
	 */
	public final String getRec()
	{
		return this.GetValStrByKey(GenerDBSrcAttr.Rec);
	}
	public final void setRec(String value)
	{
		this.SetValByKey(GenerDBSrcAttr.Rec, value);
	}
	/**
	 记录日期
	 */
	public final String getRDT()
	{
		return this.GetValStrByKey(GenerDBSrcAttr.RDT);
	}
	public final void setRDT(String value)
	{
		this.SetValByKey(GenerDBSrcAttr.RDT, value);
	}
	/**
	 控制对象类型
	 */
	public final String getObjModel()
	{
		return this.GetValStrByKey(GenerDBSrcAttr.ObjModel);
	}
	public final void setObjModel(String value)
	{
		this.SetValByKey(GenerDBSrcAttr.ObjModel, value);
	}
	/**
	 执行方式
	 */
	public final String getDoWay()
	{
		return this.GetValStrByKey(GenerDBSrcAttr.DoWay);
	}
	public final void setDoWay(String value)
	{
		this.SetValByKey(GenerDBSrcAttr.DoWay, value);
	}
	public final String getDoc()
	{
		return this.GetValStrByKey(GenerDBSrcAttr.Doc);
	}
	public final void setDoc(String value)
	{
		this.SetValByKey(GenerDBSrcAttr.Doc, value);
	}
	public final String getDBSrc()
	{
		return this.GetValStrByKey(GenerDBSrcAttr.DBSrc);
	}
	public final void setDBSrc(String value)
	{
		this.SetValByKey(GenerDBSrcAttr.DBSrc, value);
	}
	public final String getDBModel()
	{
		return this.GetValStrByKey(GenerDBSrcAttr.DBModel);
	}
	public final void setDBModel(String value)
	{
		this.SetValByKey(GenerDBSrcAttr.DBModel, value);
	}
	public final String getBodyDoc()
	{
		return this.GetValStrByKey(GenerDBSrcAttr.BodyDoc);
	}
	public final void setBodyDoc(String value)
	{
		this.SetValByKey(GenerDBSrcAttr.BodyDoc, value);
	}

	public final String getHeadDoc()
	{
		return this.GetValStrByKey(GenerDBSrcAttr.HeadDoc);
	}
	public final void setHeadDoc(String value)
	{
		this.SetValByKey(GenerDBSrcAttr.HeadDoc, value);
	}

	///#endregion

	///#region 构造方法
	/**
	 权限控制
	 */
	@Override
	public UAC getHisUAC()
	{
		UAC uac = new UAC();
		if (WebUser.getIsAdmin())
		{
			uac.IsUpdate = true;
			return uac;
		}
		return super.getHisUAC();
	}
	/**
	 数据源存储
	 */
	public GenerDBSrc()
	{
	}
	public GenerDBSrc(String mypk) throws Exception {
		this.setMyPK(mypk);
		this.Retrieve();
	}

	/** 
	 EnMap
	*/
	@Override
	public Map getEnMap()
	{
		if (this.get_enMap() != null)
		{
			return this.get_enMap();
		}

		Map map = new Map("Sys_GenerDBSrc", "数据源存储");

		map.AddMyPK();
		map.AddTBString("DoWay", null, "执行方式", true, false, 0, 100, 20); // 数据源类型: Node SelfSQL,SelfWebApi,StaticData,SearchDBSrc
		map.AddTBString("ObjModel", null, "控制实体方式", true, false, 0, 100, 20); // Frm,Flow,Node,Rpt String类型的枚举.
		map.AddTBString("DBModel", null, "数据模式", true, false, 0, 100, 20); // SFTable,Search,SFProc.
		map.AddTBString("RptID", null, "报表ID", true, false, 0, 100, 20);//1级对象ID.
		map.AddTBString("FrmID", null, "表单ID", true, false, 0, 100, 20); //1级对象ID.
		map.AddTBString("FlowNo", null, "流程ID", true, false, 0, 30, 20); //1级对象ID.
		map.AddTBInt("NodeID", 0, "节点ID", true, false); //1级对象ID，这个特殊处理.

		map.AddTBString("OperID1", null, "操作对象1", true, false, 0, 300, 20); //2级对象ID.
		map.AddTBString("OperID2", null, "操作对象2", true, false, 0, 300, 20);

		//数据源标识, 比如：大屏的windows 一个数据源. 如果该对象只有一个标记，没有指定就是Main.
		map.AddTBString("MarkID", null, "标记ID", true, false, 0, 300, 20);

		//数据源相关.
		map.AddTBString("DBSrc", "local", "数据源", true, false, 0, 100, 20);
		map.AddTBString("Doc", null, "配置内容", true, false, 0, 2000, 20);

		//WebApi相关.
		map.AddTBString("Url", null, "Url", true, false, 0, 2000, 20);
		map.AddTBString("PostModel", null, "PostModel", true, false, 0, 2000, 20);
		map.AddTBString("HeadDoc", null, "HeadDoc", true, false, 0, 2000, 20);
		map.AddTBString("BodyDoc", null, "BodyDoc", true, false, 0, 2000, 20);

		map.AddTBString("RefPKVal", null, "关联的主键", true, false, 0, 100, 20);


		map.AddTBString("OrgNo", null, "OrgNo", true, false, 0, 100, 20);
		this.set_enMap(map);
		return this.get_enMap();
	}

	///#endregion
}
